<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>linux核心技能 | 小熊的技术文档</title>
    <meta name="generator" content="VuePress 1.8.2">
    <link rel="icon" href="/fav.ico">
    <link rel="stylesheet" href="/css/katex.min.css">
    <link rel="stylesheet" href="/css/github-markdown.min.css">
    <meta name="description" content="衣带渐宽终不悔，为伊消得人憔悴">
    
    <link rel="preload" href="/assets/css/0.styles.e6449353.css" as="style"><link rel="preload" href="/assets/js/app.9e067b79.js" as="script"><link rel="preload" href="/assets/js/2.983eb755.js" as="script"><link rel="preload" href="/assets/js/12.62bd3528.js" as="script"><link rel="prefetch" href="/assets/js/10.79548333.js"><link rel="prefetch" href="/assets/js/11.31600f80.js"><link rel="prefetch" href="/assets/js/13.de8b1ace.js"><link rel="prefetch" href="/assets/js/14.f5db1e75.js"><link rel="prefetch" href="/assets/js/15.bf827d4d.js"><link rel="prefetch" href="/assets/js/16.cc9a1a73.js"><link rel="prefetch" href="/assets/js/17.2cfaefeb.js"><link rel="prefetch" href="/assets/js/18.3af7782b.js"><link rel="prefetch" href="/assets/js/19.639f7e7b.js"><link rel="prefetch" href="/assets/js/20.dc862f59.js"><link rel="prefetch" href="/assets/js/21.916e1685.js"><link rel="prefetch" href="/assets/js/22.d7a955f4.js"><link rel="prefetch" href="/assets/js/23.078391ef.js"><link rel="prefetch" href="/assets/js/24.bb460a5a.js"><link rel="prefetch" href="/assets/js/25.d69f2326.js"><link rel="prefetch" href="/assets/js/26.6da7ea48.js"><link rel="prefetch" href="/assets/js/27.82e23d91.js"><link rel="prefetch" href="/assets/js/28.9073bbec.js"><link rel="prefetch" href="/assets/js/29.639259a4.js"><link rel="prefetch" href="/assets/js/3.e594e5b2.js"><link rel="prefetch" href="/assets/js/30.b49c622d.js"><link rel="prefetch" href="/assets/js/31.92f6c8b3.js"><link rel="prefetch" href="/assets/js/32.42419088.js"><link rel="prefetch" href="/assets/js/33.c82e2ab8.js"><link rel="prefetch" href="/assets/js/34.381de37e.js"><link rel="prefetch" href="/assets/js/35.5e86d478.js"><link rel="prefetch" href="/assets/js/36.31f218ce.js"><link rel="prefetch" href="/assets/js/37.0d287b3f.js"><link rel="prefetch" href="/assets/js/38.1324cf44.js"><link rel="prefetch" href="/assets/js/39.de6bdb51.js"><link rel="prefetch" href="/assets/js/4.440c4dd9.js"><link rel="prefetch" href="/assets/js/40.a22c9c27.js"><link rel="prefetch" href="/assets/js/41.4637d617.js"><link rel="prefetch" href="/assets/js/42.db815e2b.js"><link rel="prefetch" href="/assets/js/43.f0955a92.js"><link rel="prefetch" href="/assets/js/44.7d5faddf.js"><link rel="prefetch" href="/assets/js/45.a88ffc33.js"><link rel="prefetch" href="/assets/js/46.883caa71.js"><link rel="prefetch" href="/assets/js/47.6f2cfd60.js"><link rel="prefetch" href="/assets/js/48.ea25654e.js"><link rel="prefetch" href="/assets/js/49.f38c23a0.js"><link rel="prefetch" href="/assets/js/5.e8844f36.js"><link rel="prefetch" href="/assets/js/50.e03dd8e9.js"><link rel="prefetch" href="/assets/js/51.f6160d52.js"><link rel="prefetch" href="/assets/js/52.4daa8322.js"><link rel="prefetch" href="/assets/js/53.b30992e9.js"><link rel="prefetch" href="/assets/js/54.209f17e1.js"><link rel="prefetch" href="/assets/js/55.4f1dd95b.js"><link rel="prefetch" href="/assets/js/56.147ea3e8.js"><link rel="prefetch" href="/assets/js/57.5823e0e2.js"><link rel="prefetch" href="/assets/js/58.772320f9.js"><link rel="prefetch" href="/assets/js/59.5ab55a80.js"><link rel="prefetch" href="/assets/js/6.54e1cc95.js"><link rel="prefetch" href="/assets/js/60.b47b75bb.js"><link rel="prefetch" href="/assets/js/61.0cd5a012.js"><link rel="prefetch" href="/assets/js/62.35eb5453.js"><link rel="prefetch" href="/assets/js/63.d31f2118.js"><link rel="prefetch" href="/assets/js/64.03d35d7c.js"><link rel="prefetch" href="/assets/js/65.8bdc633f.js"><link rel="prefetch" href="/assets/js/66.dbbe8867.js"><link rel="prefetch" href="/assets/js/67.228613b5.js"><link rel="prefetch" href="/assets/js/68.d10a2687.js"><link rel="prefetch" href="/assets/js/69.7903847f.js"><link rel="prefetch" href="/assets/js/7.f5ab00eb.js"><link rel="prefetch" href="/assets/js/70.11ee4e27.js"><link rel="prefetch" href="/assets/js/8.95b39934.js"><link rel="prefetch" href="/assets/js/9.26cfd48c.js">
    <link rel="stylesheet" href="/assets/css/0.styles.e6449353.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/" class="home-link router-link-active"><!----> <span class="site-name">小熊的技术文档</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/front-end/" class="nav-link">
  🎨前端
</a></div><div class="nav-item"><a href="/back-end/" class="nav-link router-link-active">
  💻后端
</a></div><div class="nav-item"><a href="/practice/" class="nav-link">
  🚀实战
</a></div><div class="nav-item"><a href="/office/" class="nav-link">
  🏢办公
</a></div><div class="nav-item"><a href="/general/" class="nav-link">
  🍓通用
</a></div><div class="nav-item"><a href="/paper/" class="nav-link">
  🐸论文
</a></div><div class="nav-item"><a href="/general/fast.html" class="nav-link">
  ⚡快速笔记
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="🦉近期重点" class="dropdown-title"><span class="title">🦉近期重点</span> <span class="arrow down"></span></button> <button type="button" aria-label="🦉近期重点" class="mobile-dropdown-title"><span class="title">🦉近期重点</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/back-end/python.html" class="nav-link">
  🐇python常用模块
</a></li><li class="dropdown-item"><!----> <a href="/practice/zrender.html" class="nav-link">
  🌹zrender源码解析
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="⭐️资源" class="dropdown-title"><span class="title">⭐️资源</span> <span class="arrow down"></span></button> <button type="button" aria-label="⭐️资源" class="mobile-dropdown-title"><span class="title">⭐️资源</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://www.birdiesearch.com/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  小鸟搜索
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://salttiger.com/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  每天一本编程书
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://gitee.com/docmirror/dev-sidecar" target="_blank" rel="noopener noreferrer" class="nav-link external">
  开发者边车
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/front-end/" class="nav-link">
  🎨前端
</a></div><div class="nav-item"><a href="/back-end/" class="nav-link router-link-active">
  💻后端
</a></div><div class="nav-item"><a href="/practice/" class="nav-link">
  🚀实战
</a></div><div class="nav-item"><a href="/office/" class="nav-link">
  🏢办公
</a></div><div class="nav-item"><a href="/general/" class="nav-link">
  🍓通用
</a></div><div class="nav-item"><a href="/paper/" class="nav-link">
  🐸论文
</a></div><div class="nav-item"><a href="/general/fast.html" class="nav-link">
  ⚡快速笔记
</a></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="🦉近期重点" class="dropdown-title"><span class="title">🦉近期重点</span> <span class="arrow down"></span></button> <button type="button" aria-label="🦉近期重点" class="mobile-dropdown-title"><span class="title">🦉近期重点</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="/back-end/python.html" class="nav-link">
  🐇python常用模块
</a></li><li class="dropdown-item"><!----> <a href="/practice/zrender.html" class="nav-link">
  🌹zrender源码解析
</a></li></ul></div></div><div class="nav-item"><div class="dropdown-wrapper"><button type="button" aria-label="⭐️资源" class="dropdown-title"><span class="title">⭐️资源</span> <span class="arrow down"></span></button> <button type="button" aria-label="⭐️资源" class="mobile-dropdown-title"><span class="title">⭐️资源</span> <span class="arrow right"></span></button> <ul class="nav-dropdown" style="display:none;"><li class="dropdown-item"><!----> <a href="https://www.birdiesearch.com/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  小鸟搜索
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://salttiger.com/" target="_blank" rel="noopener noreferrer" class="nav-link external">
  每天一本编程书
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li><li class="dropdown-item"><!----> <a href="https://gitee.com/docmirror/dev-sidecar" target="_blank" rel="noopener noreferrer" class="nav-link external">
  开发者边车
  <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul></div></div> <!----></nav>  <ul class="sidebar-links"><li><a href="/back-end/daily.html" class="sidebar-link">每日冷知识</a></li><li><a href="/back-end/python.html" class="sidebar-link">Python 常用操作笔记</a></li><li><a href="/back-end/python-projects.html" class="sidebar-link">小python项目</a></li><li><a href="/back-end/koa2.html" class="sidebar-link">使用 koa2 开发服务端</a></li><li><a href="/back-end/numpy.html" class="sidebar-link">从python到Numpy</a></li><li><a href="/back-end/linux.html" aria-current="page" class="active sidebar-link">linux核心技能</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/back-end/linux.html#终端常用命令" class="sidebar-link">终端常用命令</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/back-end/linux.html#基础命令" class="sidebar-link">基础命令</a></li><li class="sidebar-sub-header"><a href="/back-end/linux.html#目录相关命令" class="sidebar-link">目录相关命令</a></li><li class="sidebar-sub-header"><a href="/back-end/linux.html#浏览和创建文件" class="sidebar-link">浏览和创建文件</a></li><li class="sidebar-sub-header"><a href="/back-end/linux.html#文件的复制和移动操作" class="sidebar-link">文件的复制和移动操作</a></li></ul></li><li class="sidebar-sub-header"><a href="/back-end/linux.html#vi-vim常用操作" class="sidebar-link">Vi/Vim常用操作</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/back-end/linux.html#插入选择" class="sidebar-link">插入选择</a></li><li class="sidebar-sub-header"><a href="/back-end/linux.html#选择模式" class="sidebar-link">选择模式</a></li><li class="sidebar-sub-header"><a href="/back-end/linux.html#vi-vim的保存" class="sidebar-link">Vi/Vim的保存</a></li></ul></li></ul></li><li><a href="/back-end/docker.html" class="sidebar-link">Docker实战</a></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h1 id="linux核心技能"><a href="#linux核心技能" class="header-anchor">#</a> linux核心技能</h1> <h2 id="终端常用命令"><a href="#终端常用命令" class="header-anchor">#</a> 终端常用命令</h2> <h3 id="基础命令"><a href="#基础命令" class="header-anchor">#</a> 基础命令</h3> <ol><li>clear: 清屏, 也可以使用<code>Ctrl+c</code>快捷键</li></ol> <h3 id="目录相关命令"><a href="#目录相关命令" class="header-anchor">#</a> 目录相关命令</h3> <ol><li>ls(<strong>l</strong>i<strong>s</strong>t): 列出文件列表
<ul><li><code>-a</code>参数, 显示所有文件(包括隐藏文件);</li> <li><code>-A</code>参数, 与<code>-a</code>基本相同, 但不列出 &quot;.&quot; (目前目录) 及 &quot;..&quot; (父目录);</li> <li><code>-h</code>参数, 以Ko, Mo, Go显示文件大小;</li> <li><code>-l</code>参数, 除文件名称外，也将文件型态、权限、拥有者、文件大小等资讯详细列出</li></ul></li> <li>cd(<strong>c</strong>hange <strong>d</strong>irectory): 更改目录
<ul><li><code>cd ..</code>回到父级目录,</li> <li><code>~</code>表示<code>/home/[用户]</code>的家目录; 使用命令<code>cd</code>或者<code>cd ~</code>可以快速回到家目录</li></ul></li> <li>pwd(<strong>p</strong>rint <strong>w</strong>ork <strong>d</strong>irectory): 显示目前所在的工作目录的绝对路径名称;</li> <li>which: 查找命令的文件位置, 例如<code>which pwd</code>会显示<code>pwd</code>命令;</li> <li>du(<strong>d</strong>isk <strong>u</strong>sage): 显示目录或文件的大小, 默认只列出目录大小, <code>du</code>统计当前目录大小, <code>du ~</code>统计家目录总大小
<ul><li><code>-h</code>参数, 以Ko, Mo, Go显示文件大小;</li> <li><code>-a</code>参数, 显示所有(all)目录和文件大小</li> <li><code>-s</code>参数, 只显示总计(sum)大小</li></ul></li></ol> <h3 id="浏览和创建文件"><a href="#浏览和创建文件" class="header-anchor">#</a> 浏览和创建文件</h3> <ol><li>cat(<strong>c</strong>onc<strong>a</strong>tena<strong>t</strong>e): 一次性在终端显示文件的所有内容, 只需要在命令后加上想要显示的文件路径即可, 可加多个文件, 一次性全部显示.
<ul><li><code>-n</code>在显示文件内容前面加上序号(num)</li></ul></li> <li>less: 分页显示文件内容, 只需要在命令后加上想要显示的文件路径即可
<ul><li><code>空格键</code>或者<code>PageDown键</code>: 向下翻一页</li> <li><code>d键</code>: 向下翻半页</li> <li><code>回车键</code>或者<code>向下键</code>: 向下滚动一行</li> <li><code>b键</code>或者<code>PageUp键</code>: 向上翻一页</li> <li><code>y键</code>或者<code>向上键</code>: 向上滚动一行</li> <li><code>u键</code>: 向前回退半页</li> <li><code>q键</code>: 退出文件</li> <li><code>=键</code>: 显示当前屏幕字符在文件的第几行到第几行</li> <li><code>h键</code>: 显示帮助文档, 退出帮助文档按<code>q</code></li> <li><code>/键</code>: 进入搜索模式, 按<code>n键</code>跳到下一个符合的项目, 按<code>N键</code>跳到上一个符合项目</li></ul></li> <li>head: 显示文件头行, 用法为<code>head [文件名]</code>, 默认显示头10行
<ul><li><code>-n</code>参数, 指定显示的行数, <code>head [文件名] -n 15</code>表示显示文件头15行</li></ul></li> <li>tail: 显示文件尾行, 用法为<code>tail [文件名]</code>, 默认显示尾部10行
<ul><li><code>-n</code>指定显示的行数, <code>tail [文件名] -n 15</code>表示显示文件尾部15行</li> <li><code>-f</code>每隔1秒检查文件是否有追加内容, 如果有则显示新增内容, 可以用<code>Ctrl+C</code>来终止<code>tail -f</code>命令, 可以用<code>-s 4</code>指定每隔4秒检查一下文件是否有更新</li></ul></li> <li>touch: 本意是修改文件时间, 如果命令后面跟着的文件名不存在, 则会新建空文件</li> <li>mkdir(<strong>m</strong>a<strong>k</strong>e <strong>dir</strong>ectory): 新建文件夹
<ul><li><code>-p</code>递归创建目录结构, 例如<code>mkdir -p one/two/three</code>, 创建嵌套目录</li></ul></li></ol> <h3 id="文件的复制和移动操作"><a href="#文件的复制和移动操作" class="header-anchor">#</a> 文件的复制和移动操作</h3> <ol><li>cp(<strong>c</strong>o<strong>p</strong>y): 复制文件, 可以拷贝单个文件/多个文件和目录
<ul><li><code>cp [file] [file_copy]</code>将文件file复制为file_copy,</li> <li><code>cp [file] [dir]</code>将文件file复制到目录dir中, 改变名字则使用<code>cp [file] [dir]/[file_copy]</code></li> <li><code>cp [dir] [dir_copy] -r</code>复制目录, 加上<code>-r</code>表示递归复制</li> <li><code>cp *.txt [dir]</code>将当前目录下的所有txt文件拷贝到dir目录中</li></ul></li> <li>mv(<strong>m</strong>o<strong>v</strong>e): 移动文件/目录, 或者重命名文件/目录
<ul><li><code>mv [file] [dir]</code>将file移动到dir目录下</li> <li><code>mv [dir] [new_dir]</code>将dir目录移动到new_dir目录下</li> <li><code>mv [file] [new_name_file]</code>将文件<code>file</code>重命名为<code>new_name_file</code></li></ul></li> <li>rm(<strong>r</strong>e<strong>m</strong>ove): 删除文件, 终端没有回收站, <code>rmdir</code>命令只能删除空目录
<ul><li><code>rm [file]</code>删除文件file</li> <li><code>rm [file1] [file2]</code>删除多个文件file1, file2</li> <li><code>-i</code>参数, 终端会询问(inform)用户是否删除</li> <li><code>-f</code>参数, 终端会强制(force)删除文件</li> <li><code>-r</code>参数, 终端会递归(recursive)删除文件, 通常用于删除目录, 例如<code>rm [dir] -r</code></li></ul></li> <li>ln(<strong>l</strong>i<strong>n</strong>k): 创建链接, 跟windows的快捷方式很像</li></ol> <h2 id="vi-vim常用操作"><a href="#vi-vim常用操作" class="header-anchor">#</a> Vi/Vim常用操作</h2> <p>使用<code>vi [文件名]</code>打开或者创建对应的文件，然后进入模式选择状态。</p> <h3 id="插入选择"><a href="#插入选择" class="header-anchor">#</a> 插入选择</h3> <p>在文档下方的状态输入框中，输入不同字母可进入不同模式。</p> <p><code>i</code>：插入模式，在光标所在位置后面插入文本，按<code>Esc</code>键回到命令模式<br> <code>o</code>：下行插入模式，在光标所在行的下面插入新的一行，光标停在空行首，等待输入文本<br> <code>dd</code>：删除光标所在行</p> <h3 id="选择模式"><a href="#选择模式" class="header-anchor">#</a> 选择模式</h3> <p><code>v</code>：选择模式，从光标位置开始按正常模式选择文本<br> <code>V</code>：行选择，选中光标经过的完整行<br> <code>y</code>：复制选中，复制已选中的文本到剪贴板<br> <code>yy</code>：复制行，将光标所在行复制到剪贴板<br> <code>p</code>：粘贴，将剪贴板中的内容粘贴到光标后</p> <h3 id="vi-vim的保存"><a href="#vi-vim的保存" class="header-anchor">#</a> Vi/Vim的保存</h3> <p>保存有多种命令，都是在命令模式下运行：<br> <code>wq</code>回车：保存并退出 Vim 编辑器；<br> <code>q</code>回车：不保存退出 Vim 编辑器；<br> <code>w [filename]</code>：另存到 [filename] 文件；<br> <code>ZZ</code>：直接退出 Vim 编辑器。</p></div> <footer class="page-edit"><!----> <div class="last-updated"><span class="prefix">更新于:</span> <span class="time">4/17/2022, 8:06:51 PM</span></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
      ←
      <a href="/back-end/numpy.html" class="prev">
        从python到Numpy
      </a></span> <span class="next"><a href="/back-end/docker.html">
        Docker实战
      </a>
      →
    </span></p></div> </main></div><div class="global-ui"><!----></div></div>
    <script src="/assets/js/app.9e067b79.js" defer></script><script src="/assets/js/2.983eb755.js" defer></script><script src="/assets/js/12.62bd3528.js" defer></script>
  </body>
</html>
